Release 10.1A: OpenEdge Development:
Progress Dynamics Web Development Guide
Overview of CSS rules
CSS files contain a list of rules that apply formatting to elements in an HTML page. Each rule has a selector and a declaration. The declaration contains property and value pairs. Figure 5–3 shows a simple rule that establishes the font size for all paragraph elements (
<P>) in an HTML page.Figure 5–3: CSS rule example
![]()
CSS supports three basic types of selectors. You can see the three basic types in
rymain.css:
- HTML Element Selector — Defines a style for all elements of a particular type. The selector is usually an HTML tag without the brackets (
< >).For example, the
BODYHTML element selector inrymain.cssdefines the background color and font attributes:
- Class Selector — Defines a style set in a
CLASSattribute. It is always preceded by a period (.). Class selectors are called by setting theCLASSattribute in an element tag. They can assign styles to any of the elements in an HTML page (unlike the HTML Element Selector, which assigns styles to one particular element type).For example,
rymain.cssdefines the following.hideselector, which renders elements invisible on the HTML page:
The
.hideselector appears iniframe,div,andformelements, as shown in the following fragment fromdefault.htm:
- ID Selector — Defines a style set in an
IDattribute. It is always preceded by a pound sign (#). Unlike an HTML element or a class selector, an ID selector should be used only once on an HTML page. Also, the style defined in an ID selector overrides any other style setting.In Progress Dynamics, ID selectors usually apply styles to UI objects that are grouped under
spanordivelements.For example,
rymain.cssdefines the following#toobarselector, which defines the style of a toolbar object:
In
default.htm, the formatting is applied in the followingdivelement:In addition to rules using basic selector types,
rymain.cssalso contains rules that use selectors that match elements based on parent-child relationships. The selector in this type of rule is called a Contextual Selector.For example, the selector in the following rule in
rymain.cssmatchesTD(table cell) elements that are descendants of an element whoseIDattribute istoolbar:
The selector in the following rule, also in
rymain.css, shows the use of the greater-than symbol (>) to limit matching to direct descendants:
It is beyond the scope of this manual to go into more detail on CSS rules. If you implement style changes in your Progress Dynamics Web applications, you must be more familiar with the CSS specification. In particular, you must understand how CSS establishes precedence when a number of rules apply to the same element.
Again, if you need more information about CSS, a good source is the World Wide Web Consortium site at
http://www.w3.org/Style/CSS/learning. It contains lists of books, online sources, and user groups.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |